{$CLEO .cs}
thread 'DSGOLD'

:DSGOLD_LOOP
if
  $Mission_Back_to_School_Passed == 0 // Is driving school already completed?
jf @DSGOLD_DONE
wait 0
if
  0AB0: key_pressed 0x77   // F8
jf @DSGOLD_LOOP

0A8D: 2@ = read_memory 0xA4AF34 size 4 virtual_protect 0
if
  2@ == 1 // Is driving school unlocked?
jf @DSGOLD_LOCKED

// Gold medals
0A8C: write_memory 0xA49B0C size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49B04 size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AE8 size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AE0 size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AD8 size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AFC size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49ACC size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AF4 size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AD0 size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AF8 size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AF0 size 4 value 100 virtual_protect 0
0A8C: write_memory 0xA49AE4 size 4 value 100 virtual_protect 0

// progression and intro skip
0A8C: write_memory 0xA49A34 size 4 value 16 virtual_protect 0
0A8C: write_memory 0xA4EA6C size 4 value 1 virtual_protect 0

// Car generators
0A8D: 0@ = read_memory 0xA4EA64 size 4 virtual_protect 0
014C: set_parked_car_generator 0@ cars_to_generate_to 101
0A8D: 1@ = read_memory 0xA4EA68 size 4 virtual_protect 0
014C: set_parked_car_generator 1@ cars_to_generate_to 101

0ACA: show_text_box "Driving school done"
wait 1500

:DSGOLD_DONE
terminate_this_custom_script

:DSGOLD_LOCKED
0ACA: show_text_box "Driving school locked"
wait 1500
goto @DSGOLD_LOOP